home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Utilities / NewsView 1.0.0 / source / NumberDialog.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-11  |  2.1 KB  |  50 lines  |  [TEXT/KAHL]

  1. /* NumberDialog.c */
  2. /*****************************************************************************/
  3. /*                                                                           */
  4. /*    Offline USENET News Viewer                                             */
  5. /*    Written by Thomas R. Lawrence, 1993 - 1994.                            */
  6. /*                                                                           */
  7. /*    This software is Public Domain; it may be used for any purpose         */
  8. /*    whatsoever without restriction.                                        */
  9. /*                                                                           */
  10. /*    This package is distributed in the hope that it will be useful,        */
  11. /*    but WITHOUT ANY WARRANTY; without even the implied warranty of         */
  12. /*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                   */
  13. /*                                                                           */
  14. /*    Thomas R. Lawrence can be reached at tomlaw@world.std.com.             */
  15. /*                                                                           */
  16. /*****************************************************************************/
  17.  
  18. #include "MiscInfo.h"
  19. #include "Audit.h"
  20. #include "Debug.h"
  21. #include "Definitions.h"
  22.  
  23. #include "NumberDialog.h"
  24. #include "StringDialog.h"
  25. #include "Numbers.h"
  26. #include "Memory.h"
  27.  
  28.  
  29. /* present a dialog displaying InitialValue and asking for a new value.  the */
  30. /* new value is returned.  if the dialog couldn't be presented or the user cancelled, */
  31. /* then the original number is returned */
  32. long                    DoNumberDialog(char* Prompt, long InitialValue, struct MenuItemType* MCut,
  33.                                 struct MenuItemType* MPaste, struct MenuItemType* MCopy,
  34.                                 struct MenuItemType* MUndo, struct MenuItemType* MSelectAll,
  35.                                 struct MenuItemType* MClear)
  36.     {
  37.         char*                                String;
  38.  
  39.         String = IntegerToString(InitialValue);
  40.         if (String != NIL)
  41.             {
  42.                 if (DoStringDialog(Prompt,&String,MCut,MPaste,MCopy,MUndo,MSelectAll,MClear))
  43.                     {
  44.                         InitialValue = StringToInteger(String,PtrSize(String));
  45.                     }
  46.                 ReleasePtr(String);
  47.             }
  48.         return InitialValue;
  49.     }
  50.